//1. 获取二次封装好的request方法
import request from '@/utils/request';
import type { CategoryListModel } from './model/categoryStoreModel';
//2. 使用枚举来保存接口
enum Api {
  //获取一级导航分类数据
  getCategory1ListApi = '/admin/product/getCategory1',
  //获取二级导航分类数据
  getCategory2ListApi = '/admin/product/getCategory2',
  //获取三级导航分类数据
  getCategory3ListApi = '/admin/product/getCategory3',
}

//3. 定义接口函数 获取一级分类导航数据
export const reqGetCategory1ListData = () => {
  return request.get<any, CategoryListModel>(Api.getCategory1ListApi);
};

// 4. 获取二级导航分类数据
export const reqGetCategory2ListData = (category1Id: number) => {
  return request.get<any, CategoryListModel>(
    Api.getCategory2ListApi + `/${category1Id}`
  );
};
// 5. 获取三级导航分类数据
export const reqGetCategory3ListData = (category2Id: number) => {
  return request.get<any, CategoryListModel>(
    Api.getCategory3ListApi + `/${category2Id}`
  );
};
